package com.ys.erp.stage_shop_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;
import com.ys.erp.stage_shop_service.bean.condition.CsShiftScheduleCondition;
import com.ys.erp.stage_shop_service.bean.vo.CsEmpVO;
import com.ys.erp.stage_shop_service.bean.vo.CsShiftScheduleVO;
import com.ys.erp.stage_shop_service.bean.vo.EmpVO;
import com.ys.erp.stage_shop_service.service.CustomerServiceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author minamiyama
 * @date 2025/6/18 14:20
 */
@ResponseResult
@RestController
@RequiredArgsConstructor
@RequestMapping("/manage/shop/cs")
@Tag(name = "客服配置相关接口", description = "客服配置相关接口")
public class CustomerServiceController {

    private final CustomerServiceService customerServiceService;

    @GetMapping("/getShiftTimeConfig")
    @Operation(summary = "获取班次时间配置", description = "获取班次时间配置")
    @CheckEmpLogin
    public List<CsShiftScheduleVO> getShiftTimeConfig(@StageLoginEmp StageEmpDTO empDto) {
        return customerServiceService.getShiftTimeConfig(empDto);
    }

    @PostMapping("/updateShiftTimeConfig")
    @Operation(summary = "更新班次时间配置", description = "更新班次时间配置")
    @CheckEmpLogin
    public void updateShiftTimeConfig(@RequestBody @Valid List<CsShiftScheduleCondition.UpdateShiftTimeCon> con,
                                      @StageLoginEmp StageEmpDTO empDto) {
        customerServiceService.updateShiftTimeConfig(empDto, con);
    }


    @GetMapping("/getEmpList")
    @Operation(summary = "获取员工列表列表", description = "获取员工列表列表")
    @CheckEmpLogin
    public List<EmpVO> getEmpList(@StageLoginEmp StageEmpDTO empDto) {
        return customerServiceService.getEmpList();
    }

    @PostMapping("/addCsEmp")
    @Operation(summary = "添加或更新客服员工", description = "添加或更新客服员工")
    @CheckEmpLogin
    public void addCsEmp(@StageLoginEmp StageEmpDTO empDto,@RequestBody List<CsShiftScheduleCondition.AddCsEmpCon> con) {
        customerServiceService.addCsEmp(empDto, con);
    }


    @GetMapping("/getCsEmpList")
    @Operation(summary = "获取客服员工列表", description = "获取客服员工列表")
    @CheckEmpLogin
    public List<CsEmpVO> getCsEmpList(@StageLoginEmp StageEmpDTO empDto) {
        return customerServiceService.getCsEmpList();
    }

    @GetMapping("/deleteCsEmp")
    @Operation(summary = "删除客服员工", description = "删除客服员工")
    @CheckEmpLogin
    public void deleteCsEmp(@StageLoginEmp StageEmpDTO empDto, @RequestParam("id") Long id) {
        customerServiceService.deleteCsEmp(empDto, id);
    }

    @GetMapping
    @Operation(summary = "添加客服排班", description = "添加客服排班")
    @CheckEmpLogin
    public void addCsSchedule(){}

}
